package com.woniu.communitymanagement.controller;

import com.woniu.communitymanagement.entity.Complaint;
import com.woniu.communitymanagement.entity.HttpResult;
import com.woniu.communitymanagement.service.ComplaintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/complaint")
@CrossOrigin(origins = "*")
public class ComplainController {
    @Autowired
    private ComplaintService complaintService;
    @RequestMapping("/list")
    public HttpResult selectAll(String typeId,String status,Integer pageIndex,Integer pageSize){
        return complaintService.selectAll(typeId,status,pageIndex,pageSize);
    }
    @RequestMapping("/delete")
    public HttpResult deleteComplaint(int id){
        return complaintService.deleteComplaint(id);
    }
    @RequestMapping("/add")
    public HttpResult insertComplaint(@RequestBody Complaint complaint){
        return complaintService.insertComplaint(complaint);
    }
    @RequestMapping("/info")
    public HttpResult selectByOne(Integer id){
        return complaintService.selectByOne(id);
    }
    @RequestMapping("/update")
    public HttpResult updateComplaint( @RequestBody Complaint complaint){

        return complaintService.updateComplaint(complaint);
    }
    @RequestMapping("/name")
    public HttpResult selectAllName(){
        return complaintService.selectAllName();
    }
    @RequestMapping("/owner")
    public HttpResult selectAllOwner(){
        return complaintService.selectAllOwner();
    }
}
